(function () {

	var $modal = $('#pop-modal');
	var aData = null;
	var oApproved = {data:{rows:[]}}; //已审核
	var aUnApproved = {data:{rows:[]}}; //未审核
	getPageData({});
	 
	function getPageData (Filter)
	 {
	 	var Filter = Filter;
	 		Filter.page = page.page;
	 		Filter.pageSize = page.pageSize;
	 	getJson(Domain+'/mbr/usedMachAssess/doUsedMachAssessList.do', Filter, function (res) {
		  if(!res.success){
	
		    $('.am-modal-bd').text(res.errorMessage);
				
				$modal.modal();
				
				setTimeout(function () {
					$modal.modal('close');
				},iWiating);
				return;
		  }
		  else{

		  		aData = res;

		  		for (var i = 0 ; i <res.data.rows.length; i++)
		  		{
		  			if(res.data.rows[i].assessStatusName=='已评估')
		  			{
		  				oApproved.data.rows.push(res.data.rows[i]);
		  			}
		  			else
		  			{
		  				aUnApproved.data.rows.push(res.data.rows[i]);
		  			}
		  		}

		  		$('#unapv .num').text('('+aUnApproved.data.rows.length+')');
				$('#apv .num').text('('+oApproved.data.rows.length+')');

			 renderTmp('#itemlist', 'itemlisttpl',res);
			 lazyLoad.refresh(true);
			 	
		  }
		})
	 }

	 //所有页面
	 $('#allpg').on('click',function () {
	 		$('#itemlist').empty();
		 	renderTmp('#itemlist', 'itemlisttpl',aData);
			lazyLoad.refresh(true);
	 });

	 //没有审核完
	 $('#unapv').on('click',function () {
	 		$('#itemlist').empty();
		 	renderTmp('#itemlist', 'itemlisttpl',aUnApproved);
			lazyLoad.refresh(true);
	 });

	 //已经审核完
	 $('#apv').on('click',function () {
	 	$('#itemlist').empty();
	 		renderTmp('#itemlist', 'itemlisttpl',oApproved);
			lazyLoad.refresh(true);
	 });
	 

})();
